﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LxBasic;
using LxCore;

namespace LxCFD
{
    class SolvePanelVM : BindableBase
    {
        public SolvePanelVM()
        {
            ClearSolution = new DelegateCommand(() => { LxSim.Sim.CalcManage.ClearSolution(); });
            RunInitialization = new DelegateCommand(() => { LxSim.Sim.CalcManage.RunInitialization(); });
            RunSimulation = new DelegateCommand(() => { LxSim.Sim.CalcManage.RunSimulation(); });
            RunSimulationOneStep = new DelegateCommand(() => { LxSim.Sim.CalcManage.RunSimulationOneStep(); });
            StopRun = new DelegateCommand(() => { LxSim.Sim.Scheduler.SetRunningState(RunningStates.InterruptingByUser); });
        }
        public PhysicsCenter PhysicalCenter { get; } = LxSim.Sim.Physics;
        public StepCenter StepCenter { get; } = LxSim.Sim.Steps;
        public int ThreadsCount
        {
            get => MultiThreads.GetThreadsCount();
            set { MultiThreads.SetThreadsCount(value); RaisePropertyChanged(nameof(ThreadsCount)); }
        }

        private TimeDiscreteTypes[] _TimeTypes = { TimeDiscreteTypes.Steady, TimeDiscreteTypes.Implicit_1st, TimeDiscreteTypes.Implicit_2nd };

        public TimeDiscreteTypes[] TimeTypes
        {
            get { return _TimeTypes; }
            set { _TimeTypes = value; RaisePropertyChanged(nameof(TimeTypes)); }
        }
        public DelegateCommand ClearSolution { get; set; }
        public DelegateCommand RunInitialization { get; set; }
        public DelegateCommand RunSimulation { get; set; }
        public DelegateCommand RunSimulationOneStep { get; set; }
        public DelegateCommand StopRun { get; set; }

    }
}
